<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Vue-练习</title>
    <script src="https://cdn.bootcss.com/vue/2.2.2/vue.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
</head>
<body>
<div id="app">
    <p></p>
</div>

<script>
    var data;
    var instance = axios.create({
        baseURL: 'http://localhost:8081',
        timeout: 10000,
        headers: {'Content-Type': 'application/json'}
    });

    instance.get('/test')
        .then(function (response) {
            // console.log(response.data);
            data=response.data;
        })
        .catch(function (error) {
            console.log(error);
        });

    new Vue({
        el: '#app',
        data: {
            message: 'Hello Vue.js!'
        }
    })

</script>
</body>
</html>